package ui;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;


/**
 * 
 * @author Chris Augg
 * @author James Kantak
 * @version 3/6/2014
 */
public class UserPanel extends JPanel {

  /** JAVADOC NEEDED. */
  private JLabel my_lbl_name;
  /** JAVADOC NEEDED. */
  private JLabel my_lbl_email;
  
  /**
   * Create the panel.
   */
  public UserPanel() {
    setBorder(new EmptyBorder(5, 5, 5, 5));
    setLayout(new BorderLayout(0, 0));
    
    final JPanel panel = new JPanel();
    add(panel, BorderLayout.NORTH);
    panel.setLayout(new GridLayout(0, 1, 0, 0));
    panel.setBorder(new TitledBorder(Standards.BORDER_COMPOUND_FORM, "User Information"));
    
    my_lbl_name = new JLabel("Name: ");
    panel.add(my_lbl_name);
    
    my_lbl_email = new JLabel("Email: ");
    panel.add(my_lbl_email);

  }
  
  /** JAVADOC NEEDED. 
   * @param the_userdata JAVADOC NEEDED
   * */
  public UserPanel(final List<String> the_userdata) {
    super();
    loadUserProfile(the_userdata);
  }
  
  /** JAVADOC NEEDED. 
   * @param the_userdata JAVADOC NEEDED
   * */
  public void loadUserProfile(final List<String> the_userdata) {
    my_lbl_name.setText("Name: " + the_userdata.get(1) + " " + the_userdata.get(2));
    my_lbl_email.setText("Email: " + the_userdata.get(3));
  }

}
